Skip to content

Commit

Permalink
Update register to make email optional (#394)
Browse files Browse the repository at this point in the history
* Make email optional at registration

* Update changelog
  • Loading branch information
bgins committed Jul 27, 2022
1 parent 38d3818 commit 4f5861d
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

#### Features

- Adds app owned WNFS.
- Adds app owned WNFS
- Separates initialize into app and permissionedApp entrypoints
- Make email optional at registration

### v0.32.0

Expand Down
2 changes: 1 addition & 1 deletion src/auth/implementation/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const init = async (): Promise<AppState | null> => {
return new Promise((resolve) => resolve(null))
}

export const register = async (options: { username: string; email: string }): Promise<{ success: boolean }> => {
export const register = async (options: { username: string; email?: string }): Promise<{ success: boolean }> => {
const { success } = await createAccount(options)

if (success) {
Expand Down
2 changes: 1 addition & 1 deletion src/auth/implementation/lobby.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const init = async (options: PermissionedAppInitOptions): Promise<Permiss
return null
}

export const register = async (options: { username: string; email: string }): Promise<{ success: boolean }> => {
export const register = async (options: { username: string; email?: string }): Promise<{ success: boolean }> => {
return new Promise(resolve => resolve({ success: false }))
}

Expand Down
2 changes: 1 addition & 1 deletion src/auth/implementation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { Channel, ChannelOptions } from "../../auth/channel"

export type Implementation = {
init: (options: InitOptions) => Promise<State | null>
register: (options: { email: string; username: string }) => Promise<{ success: boolean }>
register: (options: { username: string; email?: string }) => Promise<{ success: boolean }>
isUsernameValid: (username: string) => Promise<boolean>
isUsernameAvailable: (username: string) => Promise<boolean>
createChannel: (options: ChannelOptions) => Promise<Channel>
Expand Down
2 changes: 1 addition & 1 deletion src/auth/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { impl } from "./implementation.js"

export const register = async (options: { username: string; email: string }): Promise<{ success: boolean }> => {
export const register = async (options: { username: string; email?: string }): Promise<{ success: boolean }> => {
return impl.register(options)
}

Expand Down
2 changes: 1 addition & 1 deletion src/auth/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const init = (options: InitOptions): Promise<State | null> => {
return authLobby.init(options)
}

export const register = (options: { username: string; email: string }): Promise<{ success: boolean }> => {
export const register = (options: { username: string; email?: string }): Promise<{ success: boolean }> => {
return authLobby.register(options)
}

Expand Down
2 changes: 1 addition & 1 deletion src/lobby/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export * from "./username.js"
*/
export async function createAccount(
userProps: {
email: string
username: string
email?: string
}
): Promise<{ success: boolean }> {
const apiEndpoint = setup.getApiEndpoint()
Expand Down

0 comments on commit 4f5861d

Please sign in to comment.