Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Proof of concept to use a partial username or even another
<apex:page id="loginPage" controller="CommunitiesLoginController" title="{!$Label.site.site_login}" showHeader="false">
<apex:form>
<apex:pageMessages></apex:pageMessages>
Username:
<apex:inputText value="{!username}" />
Password:
<apex:inputSecret value="{!password}" />
<apex:commandButton action="{!customLogin}"/>
</apex:form>
</apex:page>
global with sharing class CommunitiesLoginController {
global String username {get; set;}
global String password {get; set;}
global CommunitiesLoginController () {}
global PageReference customLogin() {
String actualUsername = username;
// here is where we would dynamically choose a field other than the username to retrieve the actual username
if (actualUsername != null && !actualUsername.contains('@')) {
actualUsername += '@7s-ray.dev';
}
return Site.login(actualUsername, password, '/');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.