@ -21,7 +21,17 @@
< / h1 >
< / div >
< div >
< div v-if ="isNotProdServer" >
< h2 class = "text-xl font-bold mb-4" > User Registration < / h2 >
< button :class ="primaryButtonClasses" @click ="registerMe()" >
Register Yourself
< / button >
< button :class ="primaryButtonClasses" @click ="becomeUser0()" >
Become User 0 ( who can register others )
< / button >
< / div >
< div class = "mt-8" >
< h2 class = "text-xl font-bold mb-4" > Notiwind Alerts < / h2 >
<!-- Notification test buttons using computed configuration -- >
@ -99,7 +109,7 @@
< div >
Register Passkey
< button :class ="primaryButtonClasses" @click ="register()" >
< button :class ="primaryButtonClasses" @click ="registerPasskey ()" >
Simplewebauthn
< / button >
< / div >
@ -235,6 +245,7 @@ import {
registerAndSavePasskey ,
SHARED_PHOTO_BASE64_KEY ,
} from "../libs/util" ;
import { testBecomeUser0 , testServerRegisterUser } from "@/test" ;
import { logger } from "../utils/logger" ;
import { Account } from "../db/tables/accounts" ;
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin" ;
@ -300,6 +311,7 @@ export default class Help extends Vue {
/ / f o r p a s s k e y s
credIdHex ? : string ;
activeDid ? : string ;
apiServer ? : string ;
jwt ? : string ;
peerSetup ? : PeerSetup ;
userName ? : string ;
@ -521,17 +533,6 @@ export default class Help extends Vue {
] ;
}
/ * *
* Method to trigger notification test
* Centralizes notification testing logic
* /
triggerTestNotification ( config : {
notification : NotificationIface ;
timeout ? : number ;
} ) {
this . $notify ( config . notification , config . timeout ) ;
}
/ * *
* Component initialization
*
@ -541,6 +542,7 @@ export default class Help extends Vue {
async mounted ( ) {
const settings = await this . $accountSettings ( ) ;
this . activeDid = settings . activeDid || "" ;
this . apiServer = settings . apiServer || "" ;
this . userName = settings . firstName ;
const account = await retrieveAccountMetadata ( this . activeDid ) ;
@ -553,6 +555,43 @@ export default class Help extends Vue {
}
}
/ * *
* Checks if running on production server
*
* @ returns True if not on production server ( enables test utilities )
* /
public isNotProdServer ( ) {
return this . apiServer !== AppString . PROD_ENDORSER_API_SERVER ;
}
async registerMe ( ) {
const response = await testServerRegisterUser ( ) ;
if ( response . status === 201 ) {
alert ( "Registration successful." ) ;
this . $router . push ( { name : "home" } ) ; / / b e c a u s e t h i s p a g e c h e c k s f o r r e g i s t e r e d s t a t u s a n d s e t s t h i n g s i f i t d e t e c t s a c h a n g e
} else {
logger . error ( "Registration failure response:" , response ) ;
alert ( "Registration failed: " + ( response . data . error || response . data ) ) ;
}
}
async becomeUser0 ( ) {
await testBecomeUser0 ( ) ;
alert ( "You are now User 0." ) ;
this . $router . push ( { name : "home" } ) ; / / b e c a u s e t h i s p a g e c h e c k s f o r r e g i s t e r e d s t a t u s a n d s e t s t h i n g s i f i t d e t e c t s a c h a n g e
}
/ * *
* Method to trigger notification test
* Centralizes notification testing logic
* /
triggerTestNotification ( config : {
notification : NotificationIface ;
timeout ? : number ;
} ) {
this . $notify ( config . notification , config . timeout ) ;
}
/ * *
* Handles file upload for image sharing tests
*
@ -609,7 +648,7 @@ export default class Help extends Vue {
* Includes validation and user confirmation workflow
* Uses notification helpers for consistent messaging
* /
public async register ( ) {
public async registerPasskey ( ) {
const DEFAULT_USERNAME = AppString . APP_NAME + " Tester" ;
if ( ! this . userName ) {
const modalConfig = createPasskeyNameModal (