Source for SMSqueakMapView>>newaccount

newaccount
	"Handle a newaccount request."

	| username msg b msg2 email account name randomPass |
	b := self builder.
	b h1: 'Register account'.
	b p: 'Before you can publish packages on SqueakMap you need to register an account, it''s real easy.'.
	b ol: {'Enter your name, developer initials (doubles as username) and your email address, then click ''Register'''.
		'A confirmation email is sent immediately - so the email address must be correct!'.
		'In the confirmation there is a link. Follow it to login to your new account and change to a personal password.'.
		'<b>Done!</b>'}.
	b postForm; columns: 2.
	name := b html: 'Name: '; colTab; inputText.
	username := b colTab; html: 'Developer initials (username): '; colTab; inputText.
	email := b colTab; html: 'Email address: ';colTab; inputText.
	b endColumns.
	b br; submit: 'Register'; reset: 'Reset'; endForm.
	b html: '<p class="error">'.
	msg := b var.
	b html: '</p>'.
	b h2: [ msg2 := b var ].
	b end.
	b ifPost: [
			(self validateUltraSafeString: username value)
				ifFalse:[msg value: 'The initials contains an invalid character!']
				ifTrue:[
					(model usernameOccupied: username value)
						ifTrue: [username error: 'Those initials are already taken!'. ^b].
					(model emailOccupied: email value)
						ifTrue: [email error: 'That email address is already taken!'. ^b].
					(self validateEmail: email value)
						ifFalse: [email error: 'Non valid email address'. ^b].
					[account := model newAccount: name value username: username value email: email value.
					randomPass := account createRandomPassword.
					model addObject: account.
					SMUtilities mailPassword: randomPass forNew: account] on: Exception do: [:ex | 
						msg value: 'Something went wrong when creating the account'. ^b].
					msg2 value: 'The account has been created. A confirmation email has been sent to <b>', email value, '</b>.']].
	b hr; linkDefault: 'Back'; end.
	^b