-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from ujwal-setlur/master
phone login support
- Loading branch information
Showing
10 changed files
with
172 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {Meteor} from 'meteor/meteor' | ||
import {Accounts} from 'meteor/accounts-base' | ||
|
||
export default async function (root, options, context) { | ||
Meteor._nodeCodeMustBeInFiber() | ||
if (!options.phone) { | ||
throw new Error('Phone number is required') | ||
} | ||
|
||
let userId = Accounts.createUserWithPhone(options) | ||
if(userId) { | ||
Accounts.sendPhoneVerificationCode(userId, options.phone); | ||
} | ||
return ({success: !!userId}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import callMethod from '../callMethod' | ||
import {Meteor} from 'meteor/meteor' | ||
|
||
|
||
export default async function (root, options, context) { | ||
if (!options.phone) { | ||
throw new Error('Phone number is required') | ||
} | ||
if (!options.verificationCode) { | ||
throw new Error('Verification code is required') | ||
} | ||
|
||
return callMethod(context, 'verifyPhone', options.phone, options.verificationCode) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import callMethod from '../callMethod' | ||
import {Meteor} from 'meteor/meteor' | ||
|
||
|
||
export default async function (root, options, context) { | ||
if (!options.phone) { | ||
throw new Error('Phone number is required') | ||
} | ||
|
||
callMethod(context, 'requestPhoneVerification', options.phone) | ||
|
||
return { | ||
success: true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters