[GH-ISSUE #2] Add GUI to enter phone number #1

Closed
opened 2026-02-26 05:32:19 +03:00 by kerem · 4 comments
Owner

Originally created by @ChristophWurst on GitHub (Jun 1, 2016).
Original GitHub issue: https://github.com/nextcloud/twofactor_gateway/issues/2

Originally created by @ChristophWurst on GitHub (Jun 1, 2016). Original GitHub issue: https://github.com/nextcloud/twofactor_gateway/issues/2
kerem 2026-02-26 05:32:19 +03:00
Author
Owner

@ChristophWurst commented on GitHub (Oct 20, 2016):

cc @eniac111 since you said you were working on that

<!-- gh-comment-id:255192164 --> @ChristophWurst commented on GitHub (Oct 20, 2016): cc @eniac111 since you said you were working on that
Author
Owner

@MariusBluem commented on GitHub (Mar 2, 2017):

  • Checkbox: Use this Phone number as 2fa-SMS number 😉
<!-- gh-comment-id:283718218 --> @MariusBluem commented on GitHub (Mar 2, 2017): - Checkbox: Use this Phone number as 2fa-SMS number 😉
Author
Owner

@ChristophWurst commented on GitHub (Mar 2, 2017):

So apparently we have an account manager to handle account data internally. This class is not exported, however. We could add it to the public API like this:

diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php
index 3701421a20..db0e19f3e6 100644
--- a/lib/private/Accounts/AccountManager.php
+++ b/lib/private/Accounts/AccountManager.php
@@ -23,6 +23,7 @@
 
 namespace OC\Accounts;
 
+use OCA\Accounts\IAccountManager;
 use OCP\IDBConnection;
 use OCP\IUser;
 use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -36,7 +37,7 @@ use Symfony\Component\EventDispatcher\GenericEvent;
  * @group DB
  * @package OC\Accounts
  */
-class AccountManager {                                                                                                                                                                                                                                                    
+class AccountManager implements IAccountManager {                                                                                                                                                                                                                         
                                                                                                                                                                                                                                                                           
        /** nobody can see my account details */                                                                                                                                                                                                                           
        const VISIBILITY_PRIVATE = 'private';                                                                                                                                                                                                                              
diff --git a/lib/public/Accounts/IAccountManager.php b/lib/public/Accounts/IAccountManager.php                                                                                                                                                                             
new file mode 100644                                                                                                                                                                                                                                                       
index 0000000000..5e58d15e1c                                                                                                                                                                                                                                               
--- /dev/null                                                                                                                                                                                                                                                              
+++ b/lib/public/Accounts/IAccountManager.php                                                                                                                                                                                                                              
@@ -0,0 +1,40 @@                                                                                                                                                                                                                                                           
+<?php                                                                                                                                                                                                                                                                     
+                                                                                                                                                                                                                                                                          
+/**                                                                                                                                                                                                                                                                       
+ * @author Christoph Wurst <christoph@winzerhof-wurst.at>                                                                                                                                                                                                                 
+ * @copyright (c) 2017, Christoph Wurst <christoph@winzerhof-wurst.at>                                                                                                                                                                                                    
+ *                                                                                                                                                                                                                                                                        
+ * @license AGPL-3.0                                                                                                                                                                                                                                                      
+ *                                                                                                                                                                                                                                                                        
+ * This code is free software: you can redistribute it and/or modify                                                                                                                                                                                                      
+ * it under the terms of the GNU Affero General Public License, version 3,                                                                                                                                                                                                
+ * as published by the Free Software Foundation.                                                                                                                                                                                                                          
+ *                                                                                                                                                                                                                                                                        
+ * This program is distributed in the hope that it will be useful,                                                                                                                                                                                                        
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of                                                                                                                                                                                                         
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                                                                                                                                                                                                           
+ * GNU Affero General Public License for more details.                                                                                                                                                                                                                    
+ *                                                                                                                                                                                                                                                                        
+ * You should have received a copy of the GNU Affero General Public License, version 3,                                                                                                                                                                                   
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>                                                                                                                                                                                                   
+ *                                                                                                                                                                                                                                                                        
+ */                                                                                                                                                                                                                                                                       
+                                                                                                                                                                                                                                                                          
+namespace OCA\Accounts;                                                                                                                                                                                                                                                   
+                                                                                                                                                                                                                                                                          
+use OCP\IUser;                                                                                                                                                                                                                                                            
+                                                                                                                                                                                                                                                                          
+/**                                                                                                                                                                                                                                                                       
+ * @since 12.0                                                                                                                                                                                                                                                            
+ */                                                                                                                                                                                                                                                                       
+interface IAccountManager {                                                                                                                                                                                                                                               
+                                                                                                                                                                                                                                                                          
+       /**                                                                                                                                                                                                                                                                
+        * Get stored data from a given user                                                                                                                                                                                                                               
+        *                                                                                                                                                                                                                                                                 
+        * @since 12.0                                                                                                                                                                                                                                                     
+        * @param IUser $user                                                                                                                                                                                                                                              
+        * @return array                                                                                                                                                                                                                                                   
+        */                                                                                                                                                                                                                                                                
+       public function getUser(IUser $user);                                                                                                                                                                                                                              
+} 
<!-- gh-comment-id:283729614 --> @ChristophWurst commented on GitHub (Mar 2, 2017): So apparently we have an account manager to handle account data internally. This class is not exported, however. We could add it to the public API like this: ```patch diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php index 3701421a20..db0e19f3e6 100644 --- a/lib/private/Accounts/AccountManager.php +++ b/lib/private/Accounts/AccountManager.php @@ -23,6 +23,7 @@ namespace OC\Accounts; +use OCA\Accounts\IAccountManager; use OCP\IDBConnection; use OCP\IUser; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -36,7 +37,7 @@ use Symfony\Component\EventDispatcher\GenericEvent; * @group DB * @package OC\Accounts */ -class AccountManager { +class AccountManager implements IAccountManager { /** nobody can see my account details */ const VISIBILITY_PRIVATE = 'private'; diff --git a/lib/public/Accounts/IAccountManager.php b/lib/public/Accounts/IAccountManager.php new file mode 100644 index 0000000000..5e58d15e1c --- /dev/null +++ b/lib/public/Accounts/IAccountManager.php @@ -0,0 +1,40 @@ +<?php + +/** + * @author Christoph Wurst <christoph@winzerhof-wurst.at> + * @copyright (c) 2017, Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ + +namespace OCA\Accounts; + +use OCP\IUser; + +/** + * @since 12.0 + */ +interface IAccountManager { + + /** + * Get stored data from a given user + * + * @since 12.0 + * @param IUser $user + * @return array + */ + public function getUser(IUser $user); +} ```
Author
Owner

@ChristophWurst commented on GitHub (Aug 21, 2018):

Fixed.

<!-- gh-comment-id:414670035 --> @ChristophWurst commented on GitHub (Aug 21, 2018): Fixed.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/twofactor_gateway-nextcloud#1
No description provided.