Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Proof of concept to use a partial username or even another
<apex:page id="loginPage" controller="CommunitiesLoginController" title="{!$}" showHeader="false">
<apex:inputText value="{!username}" />
<apex:inputSecret value="{!password}" />
<apex:commandButton action="{!customLogin}"/>
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 += '';
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.